Skip to content

Make multiple libraries warning more consistent #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2016

Conversation

matthijskooijman
Copy link
Collaborator

Originally, this warning was always printed when multiple libraries were
found for a header filename. #37 reported that this can be confusing for
novice users, when for example a platform library overrides a builtin
library, which is typically considered "normal" and should not generate
a warning.

The previous attempt at fixing #37 (which is reverted by this PR) would hide the
warning in these "normal" cases, but it ended up also hiding the message
in cases where it would be relevant (as reported on the mailing
list
). Also, if for a single compilation some of these messages are
hidden, but others are not, this might cause users to draw incorrect
conclusions if they are not aware of the exceptions ("there must be only
one library for this header file, since I didn't see any message").

This commit takes a different approach: these messages are only shown when:

  • The sketch fails to compile. In this case, the message is emitted as a
    warning, shown in red in the IDE.
  • Verbose compilation is enabled. In this case, the message is emitted
    as informational, shown in white in the IDE.

This means that these message are either all shown, or none of them
are shown, which should make the behaviour more predictable. There is
still a chance that the "normal" messages described in #37 confuse a
novice user when there is a compilation error completely unrelated to
the chosen libraries, but it is pretty impossible for arduino-builder to
know the cause of a failed compilation, so just showing all of these
messages on an error seems the best approach.

…" again

This reverts commit 2058479:

	Adding info in LibraryResolutionResult about whether selected
	library comes from a platform or from outside. If the former and
	there are duplicates, no warning is printed

Additionally, the librariesInSomePlatform function and
librariesInPlatforms variable in resolveLibrary are removed, since these
are now unused.

The original suggestion in arduino#37 was that if a platform library overrides
a builtin library, no warning would be needed. The implementation,
however, was hiding the warning whenever a platform library was
overriding any other library, including a user library, which seems
harmful (This was [reported on the devlist][1]).

This commit reverts the exception added for arduino#37, making the warning
appear unconditionally again. In a future commit, a better solution
for arduino#37 will be added.

[1]: https://groups.google.com/a/arduino.cc/d/msg/developers/1kkIqIsbuzU/0-abwr1gBQAJ

Signed-off-by: Matthijs Kooijman <[email protected]>
Previously, this warning was always printed when multiple libraries were
found for a header filename. arduino#37 reported that this can be confusing for
novice users, when for example a platform library overrides a builtin
library, which is typically considered "normal" and should not generate
a warning.

The previous attempt at fixing arduino#37 (which was reverted) would hide the
warning in these "normal" cases, but it ended up also hiding the message
in cases where it would be relevant (as [reported on the mailing
list][1]). Also, if for a single compilation some of these messages are
hidden, but others are not, this might cause users to draw incorrect
conclusions if they are not aware of the exceptions ("there must be only
one library for this header file, since I didn't see any message").

This commit takes a different approach: these messages are only shown when:
 - The sketch fails to compile. In this case, the message is emitted as a
   warning, shown in red in the IDE.
 - Verbose compilation is enabled. In this case, the message is emitted
   as informational, shown in white in the IDE.

This means that these message are either *all* shown, or *none* of them
are shown, which should make the behaviour more predictable. There is
still a chance that the "normal" messages described in arduino#37 confuse a
novice user when there is a compilation error completely unrelated to
the chosen libraries, but it is pretty impossible for arduino-builder to
know the cause of a failed compilation, so just showing all of these
messages on an error seems the best approach.

This fixes arduino#37 (again).

[1]: https://groups.google.com/a/arduino.cc/d/msg/developers/1kkIqIsbuzU/0-abwr1gBQAJ

Signed-off-by: Matthijs Kooijman <[email protected]>
@ArduinoBot
Copy link
Contributor

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/arduino-builder/arduino-builder-151.zip

ℹ️ To test this build:

  1. Replace arduino-builder binary (you can find it where you installed the IDE) with the provided one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants